package com.huashi.dealer.modular.controller.store.market;

import com.huashi.dealer.core.pojo.CommonResult;
import com.huashi.dealer.modular.business.setting.param.FullFreeSettingParam;
import com.huashi.dealer.modular.business.setting.service.StoreSettingService;
import com.huashi.dealer.modular.business.setting.vo.FullFreeSettingVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Tag(name = "Store端营销基础功能")
@RestController("storeMarketBasicController")
@RequestMapping("/store/market/basic")
@Validated
public class BasicController {

    @Resource
    private StoreSettingService storeSettingService;

    @GetMapping("/full-free")
    @Operation(summary = "获取满额包邮设置")
    public CommonResult<FullFreeSettingVo> getFullFreeSetting() {
        return CommonResult.data(storeSettingService.getFullFreeSetting());
    }

    @PostMapping("/full-free")
    @Operation(summary = "更新满额包邮设置")
    public CommonResult<String> updateFullFreeSetting(@RequestBody FullFreeSettingParam param) {
        storeSettingService.updateFullFreeSetting(param);
        return CommonResult.ok("操作成功");
    }
}
